package com.suncam.suncam2.service.impl;

import com.suncam.suncam2.entity.UserDO;
import com.suncam.suncam2.mapper.UserMapper;
import com.suncam.suncam2.service.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author LZM
 * @version 1.0
 * @Date 2022/1/13
 * @Description
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class UserServiceImpl implements UserService {
    private static final Logger log = LoggerFactory.getLogger(UserServiceImpl.class);

    @Autowired
    private UserMapper userMapper;

    @Override
    public void save(UserDO user) {
        userMapper.insert(user);
        log.debug("用户信息保存成功");
    }

    @Override
    public List<UserDO> listUsers() {
        return userMapper.selectList(null);
    }


}
